<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    	<% 
String path = request.getContextPath(); 
// 获得项目完全路径（假设你的项目叫MyApp，那么获得到的地址就是 http://localhost:8080/MyApp/）: 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 
%> 
<!DOCTYPE html>
<html>
<head>
<base href=" <%=basePath%>"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="后台用户管理">
<meta name="author" content="xwj">
<title>用户管理</title>
<link href="bootstrap/bootstrap.css" rel="stylesheet">

<link href="css/admin_css/assets/font-awesome/css/font-awesome.css"
	rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="css/admin_css/assets/css/zabuto_calendar.css">
<link rel="stylesheet" type="text/css"
	href="css/admin_css/assets/js/gritter/css/jquery.gritter.css" />
<link rel="stylesheet" type="text/css"
	href="css/admin_css/assets/lineicons/style.css">

<link href="css/admin_css/assets/css/style.css" rel="stylesheet">
<link href="css/admin_css/assets/css/style-responsive.css"
	rel="stylesheet">
<script src="jquery/jquery-2.2.4.min.js"></script>
<script src="bootstrap/bootstrap.min.js"></script>

<script class="include" type="text/javascript"
	src="css/admin_css/assets/js/jquery.dcjqaccordion.2.7.js"></script>
<script src="css/admin_css/assets/js/jquery.scrollTo.min.js"></script>
<script src="css/admin_css/assets/js/common-scripts.js"></script>

<script src="bootstrap/bootstrap.min.js"></script>
<!-- 表单验证 -->
<script
	src="bootstrap/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
<!-- 分页工具 -->

   
    <script type="text/javascript">

    $(function() {
    	// $('select.styled').customSelect();
    	$("#pwd_form").bootstrapValidator({
			message : 'This value is not valid',
			feedbackIcons : {/*输入框不同状态，显示图片的样式*/
				valid : 'glyphicon glyphicon-ok',
				invalid : 'glyphicon glyphicon-remove',
				validating : 'glyphicon glyphicon-refresh'
			},
			fields : {/*验证*/
				oldpwd : {/*键名username和input name值对应*/
					message : 'The cname is not valid',
					validators : {
						notEmpty : {/*非空提示*/
							message : '密码不能为空'
						},
						stringLength : {/*长度提示*/
							min : 6,
							max : 16,
							message : '密码的长度必须在6到16之间'
						},remote : { //查询是否有相同的用户名
							url : "../adminMsg/yzPwd.do",
							type : "post",
							data : {
								"oldpwd" : $("input[name='oldpwd']").val()
							},
							delay : 2000, //ls后执行ajax
							dataType : "json",
							message : "原密码不正确！"//提示信息
						}

					}
				},
				newpwd : {
					message : 'The cdesc is not valid',
					validators : {
						stringLength : {/*长度提示*/
							min : 6,
							max : 16,
							message : '密码的长度必须在6到16之间'
						}
					}
				},
				repwd: {
	                message:'密码无效',
	                validators: {
	                    notEmpty: {
	                        message: '不能为空'
	                    },
	                    identical: {
	                    	field: 'newpwd',
	                    	message: '两次密码必须一致'
	                    }
	                }
	            }
			}
		});
    	
		}
    );
    function updatePwd(){
    	var newpwd= $("input[name='newpwd']").val()
    	$.ajax({
			url : 'adminMsg/upAdminPwd.do',
			type : 'POST',
			async : "true",
			data : {
				"newpwd" :newpwd
			},
			dataType : 'json',
			success : function(data) {
				if (data.res > 0) {
					alert("修改成功！需重新登录！");
					window.location.replace("login.jsp");
				}else{
					alert("修改失败！");
				}
			}
		});
    }
  </script>
 
</head>
<body>
<section id="container" >
     
      <!--header start-->
     <%@include file="header.jsp"%>
      <!--header end-->

      <!--sidebar start-->
        <aside>
          <div id="sidebar"  class="nav-collapse ">
              <!-- sidebar menu start-->
              <ul class="sidebar-menu" id="nav-accordion">
              
              	  <p class="centered"><a href="admin/adminmag.jsp"><img src="images/admin7.png" class="img-circle" width="60"/></a></p>
              	  <h5 class="centered">${admin.aname}</h5>
              	  	
                  <li class="mt">
                      <a  href="admin/index.jsp">
                          <i class="fa fa-bar-chart-o"></i>
                          <span>销售统计</span>
                      </a>
                  </li>

                  <li class="sub-menu">
                      <a  href="javascript:;" >
                          <i class="fa fa-book"></i>
                          <span>书籍</span>
                      </a>
                      <ul class="sub">
                          <li ><a  href="admin/bookmag.jsp">书籍管理</a></li>
                          <li ><a  href="admin/categorymag.jsp">类别管理</a></li>
                       
                      </ul>
                  </li>

                  <li class="sub-menu">
                      <a class="active" href="javascript:;" >
                          <i class="fa fa-users"></i>
                          <span>账户</span>
                      </a>
                      <ul class="sub">
                          <li><a  href="admin/usermag.jsp">用户管理</a></li>
                          <li  class="active"><a  href="admin/adminmag.jsp">管理员管理</a></li>
                        
                      </ul>
                  </li>
                  <li class="sub-menu">
                      <a href="javascript:;" >
                          <i class="fa fa-user"></i>
                          <span>会员</span>
                      </a>
                      <ul class="sub">
                          <li><a  href="admin/membermag.jsp">会员折扣管理</a></li>
                       
                      </ul>
                  </li>
                  <li class="sub-menu">
                      <a href="javascript:;" >
                          <i class="fa fa-shopping-cart"></i>
                          <span>订单</span>
                      </a>
                      <ul class="sub">
                          <li><a  href="admin/ordermag.jsp">订单管理</a></li>
                      </ul>
                  </li>
                 
              </ul>
              <!-- sidebar menu end-->
          </div>
      </aside>
      <!--sidebar end-->
       <!-- **********************************************************************************************************************************************************
     以上是不变的内容--包括上边header和左边aside33###以下是变化的内容
      *********************************************************************************************************************************************************** -->

      <!--main content start-->
      <section id="main-content">
       <section class="wrapper">
       <h3><i class="fa fa-angle-right"></i> 管理员修改密码</h3>
    	 <div class="row mt">
					<div class="col-lg-12">
						<div class="form-panel">
							<h5 class="mb">
								<i class="fa fa-angle-right"></i>密码修改
							</h5>
							<form class="form-inline" role="form" id="pwd_form">
								<div class="form-group">
									<input type="password" name="oldpwd" class="form-control"
										placeholder="原密码">
								</div>
								<div class="form-group">
									<input type="password" name="newpwd" class="form-control"
										placeholder="请输入新密码">
								</div>
								<div class="form-group">
									<input type="password" name="repwd" class="form-control"
										placeholder="再次输入新密码">
								</div>
								<button type="button" class="btn btn-theme"
									onclick="updatePwd()">修改</button>

							</form>

						</div>
				</div>
       </div>
         
         </section>
      </section><!-- /MAIN CONTENT -->

      <!--main content end-->
     
  </section>

 

</body>
</html>